package com.dubbo.server.util;


import com.dubbo.server.pojo.Admin;

public class AdminThreadLocal {

    private static final ThreadLocal<Admin> LOCAL = new ThreadLocal<>();

    private AdminThreadLocal() {
    }

    /**
     * 将对象放入到ThreadLocal
     *
     * @param user
     */
    public static void set(Admin user) {
        LOCAL.set(user);
    }

    /**
     * 返回当前线程中的User对象
     *
     * @return
     */
    public static Admin get() {
        return LOCAL.get();
    }

    /**
     * 删除当前线程中的User对象
     */
    public static void remove() {
        LOCAL.remove();
    }

}
